package com.sponsorpay.sdk.android.credentials;

import android.content.Context;
import com.sponsorpay.sdk.android.utils.HostInfo;
import com.sponsorpay.sdk.android.utils.StringUtils;
import com.sponsorpay.sdk.android.utils.UserId;
import java.util.UUID;

public class SPCredentials
{
  private final String mAppId;
  private final String mCredentialsToken;
  private final HostInfo mHostInfo;
  private String mSecurityToken;
  private final String mUserId;

  public SPCredentials(String paramString1, String paramString2, String paramString3, Context paramContext)
  {
    if (StringUtils.nullOrEmpty(paramString1))
      throw new IllegalArgumentException("AppID cannot be null!");
    this.mSecurityToken = StringUtils.trim(paramString3);
    this.mHostInfo = new HostInfo(paramContext);
    this.mAppId = StringUtils.trim(paramString1);
    this.mCredentialsToken = getCredentialsToken(this.mAppId, paramString2);
    if (StringUtils.nullOrEmpty(paramString2))
    {
      this.mUserId = UserId.getAutoGenerated(paramContext, this.mHostInfo);
      return;
    }
    this.mUserId = paramString2;
  }

  public static String getCredentialsToken(String paramString1, String paramString2)
  {
    if (StringUtils.nullOrEmpty(paramString1))
      throw new IllegalArgumentException("AppID cannot be null!");
    if (StringUtils.nullOrEmpty(paramString2))
      paramString2 = "";
    return UUID.nameUUIDFromBytes((paramString1 + "-" + paramString2).getBytes()).toString();
  }

  public String getAppId()
  {
    return this.mAppId;
  }

  public String getCredentialsToken()
  {
    return this.mCredentialsToken;
  }

  public HostInfo getHostInfo()
  {
    return this.mHostInfo;
  }

  public String getSecurityToken()
  {
    return this.mSecurityToken;
  }

  public String getUserId()
  {
    return this.mUserId;
  }

  public void setSecurityToken(String paramString)
  {
    this.mSecurityToken = paramString;
  }

  public String toString()
  {
    Object[] arrayOfObject = new Object[4];
    arrayOfObject[0] = this.mCredentialsToken;
    arrayOfObject[1] = this.mAppId;
    String str1;
    if (StringUtils.notNullNorEmpty(this.mUserId))
    {
      str1 = this.mUserId;
      arrayOfObject[2] = str1;
      if (!StringUtils.notNullNorEmpty(this.mSecurityToken))
        break label70;
    }
    label70: for (String str2 = this.mSecurityToken; ; str2 = "N/A")
    {
      arrayOfObject[3] = str2;
      return String.format("Credentials token - %s\nAppId - %s\nUserId - %s\nSecurityToken - %s", arrayOfObject);
      str1 = "N/A";
      break;
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.sponsorpay.sdk.android.credentials.SPCredentials
 * JD-Core Version:    0.6.2
 */